package com.shengxian.basic.mylogin.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.shengxian.basic.mylogin.entity.UserDenglu;
import com.shengxian.basic.mylogin.entity.qiye_renzheng;
import com.shengxian.basic.mylogin.entity.renyuanyinru;
import com.shengxian.basic.mylogin.mapper.qiye_renzhengmapper;
import com.shengxian.basic.mylogin.mapper.renyuanyinrumapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Api(description = "企业认证管理")
@RestController
@RequestMapping("/compony")
@CrossOrigin
public class renzhengcontroller {
    @Autowired
    private qiye_renzhengmapper myqiye_renzhengmapper;
    @Autowired
    private renyuanyinrumapper myrenyuanyinrumapper;

    @ApiOperation(value = "企业认证")
    @PostMapping("renzheng")
    public void renzheng(@RequestBody qiye_renzheng myqiye_renzheng) {
        Map<String, Object> mymap = new HashMap<>();
        mymap.put("qiye_name", myqiye_renzheng.getQiye_name());
        List<qiye_renzheng> qiye_renzhengs = myqiye_renzhengmapper.selectByMap(mymap);
        if (qiye_renzhengs.isEmpty()) {
            System.out.println(" 没有    可以添加");
            myqiye_renzhengmapper.insert(myqiye_renzheng);
        } else {
            System.out.println(" 已经有  不能添加");
        }

    }


    @ApiOperation(value = "人员引入")
    @PostMapping("persionjoin")
    public void loginpassword(@RequestBody renyuanyinru myrenyuanyinru) {

        Map<String, Object> mymap = new HashMap<>();
        mymap.put("rolename", myrenyuanyinru.getRolename());
        List<renyuanyinru> myrenyuanyinruList = myrenyuanyinrumapper.selectByMap(mymap);
        if (myrenyuanyinruList.isEmpty()) {
            System.out.println(" 没有    可以添加");
            myrenyuanyinrumapper.insert(myrenyuanyinru);
        } else {
            System.out.println(" 已经有  不能添加");
        }


    }


}
